<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="12" style="padding-left: 20px">
        <h2>充电桩智能管理平台</h2>
        <p>
          本系统是一个专业的充电桩管理平台，提供充电桩设备管理、充电订单管理、用户管理、数据统计等功能。系统采用现代化的技术架构，支持多场景应用，包括公共充电站、小区充电桩、商业场所充电设施等。通过本系统，您可以轻松实现充电桩的智能化管理和运营。
        </p>
        <p>
          <b>当前版本:</b> <span>v{{ version }}</span>
        </p>
        <p>
          <el-tag type="success">智能充电 · 绿色出行</el-tag>
        </p>
        <p>
          <el-button
            type="primary"
            size="mini"
            icon="el-icon-monitor"
            plain
            @click="goTarget('https://www.example.com')"
            >系统演示</el-button
          >
          <el-button
            size="mini"
            icon="el-icon-document"
            plain
            @click="goTarget('https://www.example.com/docs')"
            >使用文档</el-button
          >
        </p>
      </el-col>

      <el-col :sm="24" :lg="12" style="padding-left: 50px">
        <el-row>
          <el-col :span="12">
            <h2>系统功能</h2>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <h4>核心功能</h4>
            <ul>
              <li>充电桩管理</li>
              <li>订单管理</li>
              <li>用户管理</li>
              <li>支付管理</li>
              <li>数据统计</li>
              <li>故障监控</li>
              <li>...</li>
            </ul>
          </el-col>
          <el-col :span="6">
            <h4>技术特点</h4>
            <ul>
              <li>实时监控</li>
              <li>智能调度</li>
              <li>远程控制</li>
              <li>数据分析</li>
              <li>故障预警</li>
              <li>多端支持</li>
              <li>...</li>
            </ul>
          </el-col>
        </el-row>
      </el-col>
    </el-row>
    <el-divider />
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>联系我们</span>
          </div>
          <div class="body">
            <p>
              <i class="el-icon-s-promotion"></i> 官网：<el-link
                href="https://www.wbstar.com"
                target="_blank"
                >https://www.wbstar.com</el-link
              >
            </p>
            <p>
              <i class="el-icon-phone"></i> 服务热线：13206585309
            </p>
            <p>
              <i class="el-icon-message"></i> 邮箱：3282165930qq.com
            </p>
            <p>
              <i class="el-icon-location"></i> 地址：保定市莲池区虎振西街道振涛教育
            </p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>系统公告</span>
          </div>
          <el-collapse accordion>
            <el-collapse-item title="v1.0.0 - 2024-03-20">
              <ol>
                <li>系统正式上线运行</li>
                <li>支持充电桩基础管理功能</li>
                <li>支持订单管理和支付功能</li>
                <li>支持数据统计和报表功能</li>
                <li>支持故障监控和预警功能</li>
              </ol>
            </el-collapse-item>
          </el-collapse>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="8">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>快速入口</span>
          </div>
          <div class="body">
            <el-button type="primary" plain style="width: 100%; margin-bottom: 10px" @click="handleRoute('/equipment/charging')">充电桩管理</el-button>
            <el-button type="success" plain style="width: 100%; margin-bottom: 10px" @click="handleRoute('/order/management')">订单管理</el-button>
            <el-button type="warning" plain style="width: 100%; margin-bottom: 10px" @click="handleRoute('/statistics/analysis')">数据统计</el-button>
            <el-button type="info" plain style="width: 100%" @click="handleRoute('/system/settings')">系统设置</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "1.0.0",
    };
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    handleRoute(path) {
      console.log('Attempting to navigate to:', path);
      try {
        this.$router.push(path).then(() => {
          console.log('Navigation successful');
        }).catch(err => {
          console.error('Navigation failed:', err);
          if (err.name !== 'NavigationDuplicated') {
            this.$message.error('页面跳转失败，请稍后重试');
          }
        });
      } catch (error) {
        console.error('Navigation error:', error);
        this.$message.error('页面跳转失败，请稍后重试');
      }
    }
  },
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>

